<extend name="Public/base"/>

<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>新增品牌</h2>
    </div>
    <form action="{:U()}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">品牌名称<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="brandname" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">品牌网址<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="brandurl" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">品牌LOGO<span class="check-tips"></span></label>
            <div class="controls">
                <input type="file" id="upload_picture_cover_id">
                <input type="hidden" name="logourl" id="cover_id_cover_id"/>
                <div class="upload-img-box">
                
                </div>
            </div>
            <script type="text/javascript">
            //上传图片
            /* 初始化上传插件 */
            $("#upload_picture_cover_id").uploadify({
                "height"          : 30,
                "swf"             : "__STATIC__/uploadify/uploadify.swf",
                "fileObjName"     : "download",
                "buttonText"      : "上传图片",
                "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                "width"           : 120,
                'removeTimeout'   : 1,
                'fileTypeExts'    : '*.jpg; *.png; *.gif;',
                "onUploadSuccess" : uploadPicturecover_id,
                'onFallback' : function() {
                    alert('未检测到兼容版本的Flash.');
                }
            });
            function uploadPicturecover_id(file, data){
                var data = $.parseJSON(data);
                var src = '';
                if(data.status){
                    $("#cover_id_cover_id").val(data.path);                    
                    src = data.url || '__ROOT__' + data.path;
                    $("#cover_id_cover_id").parent().find('.upload-img-box').html(
                        '<div class="upload-pre-item"><img src="' + src + '"/></div><a href="'+data.id+'">删除</a>'
                    );
                } else {
                    updateAlert(data.info);
                    setTimeout(function(){
                        $('#top-alert').find('button').click();
                        $(that).removeClass('disabled').prop('disabled',false);
                    },1500);
                }
            }
            </script>
        </div>
        <div class="form-item">
            <label class="item-label">品牌描述<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="branddesc" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">排序<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="sort" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">是否显示<span class="check-tips"></span></label>
            <div class="controls">
                <label class="radio">
                    <input type="radio" class="" name="is_show" value="1"> 开启
                </label>
                <label class="radio">
                    <input type="radio" class=" " name="is_show" value="0"> 关闭 
                </label>
            </div>
        </div>
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('User/index')}');
    </script>
</block>
